package com.hyt.it.ogt.controller.ykcj.exam;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.annotation.Log;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.common.enums.BusinessType;
import com.hyt.it.ogt.ykcj.common.utils.poi.ExcelUtil;
import com.hyt.it.ogt.ykcj.domain.exam.ExamStemInfo;
import com.hyt.it.ogt.ykcj.service.exam.IExamStemInfoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;

/**
 * 考试题干信息Controller
 * 
 * @author admin
 * @date 2021-09-09
 */
@Api(tags = "exam.6.考试题干信息", value = "考试题干信息请求接口")
@ApiSort(value = 106)
@RestController
@RequestMapping("/exam/stemInfo")
public class ExamStemInfoController extends BaseController
{
    @Autowired
    private IExamStemInfoService examStemInfoService;

    /**
     * 查询考试题干信息列表
     */
    @ApiOperation("查询考试题干信息列表")
    @GetMapping("/list")
    public TableDataInfo list(ExamStemInfo examStemInfo)
    {
        startPage();
        List<ExamStemInfo> list = examStemInfoService.selectExamStemInfoList(examStemInfo);
        return getDataTable(list);
    }

    /**
     * 导出考试题干信息列表
     */
    @ApiOperation("导出考试题干信息列表")
    @Log(title = "考试题干信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ExamStemInfo examStemInfo)
    {
        List<ExamStemInfo> list = examStemInfoService.selectExamStemInfoList(examStemInfo);
        ExcelUtil<ExamStemInfo> util = new ExcelUtil<ExamStemInfo>(ExamStemInfo.class);
        return util.exportExcel(list, "考试题干信息数据");
    }

    /**
     * 获取考试题干信息详细信息
     */
    @ApiOperation("获取考试题干信息详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(examStemInfoService.selectExamStemInfoById(id));
    }

    /**
     * 新增考试题干信息
     */
    @ApiOperation("新增考试题干信息")
    @Log(title = "考试题干信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ExamStemInfo examStemInfo)
    {
        return toAjax(examStemInfoService.insertExamStemInfo(examStemInfo));
    }

    /**
     * 修改考试题干信息
     */
    @ApiOperation("修改考试题干信息")
    @Log(title = "考试题干信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ExamStemInfo examStemInfo)
    {
        return toAjax(examStemInfoService.updateExamStemInfo(examStemInfo));
    }

    /**
     * 删除考试题干信息
     */
    @ApiOperation("删除考试题干信息")
    @Log(title = "考试题干信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(examStemInfoService.deleteExamStemInfoByIds(ids));
    }
}
